﻿using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCommon.Helper
{
    /// <summary>
    /// 配置文件类
    /// </summary>
    public class Appsettings
    {
        /// <summary>
        /// 注入配置
        /// </summary>
        public static IConfiguration Configuration { get; set; }

        public Appsettings(IConfiguration configuration)
        {
            Configuration = configuration;
        }
        /// <summary>
        /// 供外界使用
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static string app(params string[] args)
        {
            try
            {
                if (args.Any()) return Configuration[string.Join(":", args)];
            }
            catch (Exception)
            { }
            return "";
        }
    }
}
